package com.javafactroy.kunlong.bip.socket;

import com.javafactroy.kunlong.bip.icp.message.dxp.app.HandshakeMessage;
import com.javafactroy.kunlong.bip.icp.message.dxp.base.DxpMsg;


import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class TestMessage {

    public static void main(String[] args) {
        ByteBuffer byteBuffer = ByteBuffer.allocate(8);
        byteBuffer.order(ByteOrder.BIG_ENDIAN);
        byteBuffer.putInt(8);
        byteBuffer.put("ABCD".getBytes());
        byte[] ll = byteBuffer.array();
        System.out.println("1");

        DxpMsg m = DxpMsg.buildMessage();
        byte[] bytes = m.encode();
        System.out.println(new String(bytes));
        DxpMsg mm = new DxpMsg();
        mm.decode(bytes);
        System.err.println(mm);

        HandshakeMessage hsm = new HandshakeMessage("BPM");
        byte[] hs = hsm.encode();
        System.out.println(new String(hs));
    }
}
